feat(UI): add gpg-key setting#1397
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds GPG key management functionality to the user settings page, allowing users to view, add, and delete GPG keys associated with their account.
- Adds new GPG key management UI component with list view, add dialog, and delete functionality
- Creates three custom hooks for GPG key operations (get list, add key, delete key)
- Integrates the new GPG key settings into the existing user settings page
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| moon/apps/web/pages/me/settings/index.tsx | Imports and renders the new GPGKeys component in the settings page |
| moon/apps/web/hooks/usePostGPGKey.ts | Hook for adding new GPG keys via API mutation |
| moon/apps/web/hooks/useGetGPGList.ts | Hook for fetching and caching GPG key list with local storage |
| moon/apps/web/hooks/useDeleteGPGKeyById.ts | Hook for deleting GPG keys by ID via API mutation |
| moon/apps/web/components/Setting/GPGKeys.tsx | Complete GPG key management UI with list display, add dialog, and delete functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <p className="text-base font-bold text-gray-900">{ keyData.fingerprint }</p> | ||
| <p className="text-sm font-mono text-gray-500 mt-1">{ keyData.fingerprint }</p> |
There was a problem hiding this comment.
Both lines display the same fingerprint value. The second line appears to be intended for a different piece of information (possibly key ID or a shortened version).
| <p className="text-base font-bold text-gray-900">{ keyData.fingerprint }</p> | |
| <p className="text-sm font-mono text-gray-500 mt-1">{ keyData.fingerprint }</p> | |
| <p className="text-sm font-mono text-gray-500 mt-1">{ keyData.key_id }</p> |
| postGPGKey( | ||
| { | ||
| data: { | ||
| expires_days: 10, |
There was a problem hiding this comment.
Hard-coded expires_days value of 10 ignores the user-selected expires_days date from the form. This should use the calculated difference between the selected date and current date.
| postGPGKey( | |
| { | |
| data: { | |
| expires_days: 10, | |
| // Calculate the number of days between now and the selected expiration date | |
| const now = new Date(); | |
| const diffTime = expires_days.getTime() - now.getTime(); | |
| const diffDays = Math.max(1, Math.ceil(diffTime / (1000 * 60 * 60 * 24))); | |
| postGPGKey( | |
| { | |
| data: { | |
| expires_days: diffDays, |
| <h2 className="text-xl font-semibold text-gray-900 pb-2 border-b border-gray-200"> | ||
| Authentication keys | ||
| </h2> | ||
| { isGPGLoading? ( |
There was a problem hiding this comment.
Missing space before the question mark. Should be { isGPGLoading ? (
| { isGPGLoading? ( | |
| { isGPGLoading ? ( |
| {/*<div className='mb-4'>*/ } | ||
| {/* <TextField*/ } | ||
| {/* autoFocus*/ } | ||
| {/* label='title'*/ } | ||
| {/* value={title}*/ } | ||
| {/* onChange={setTitle}*/ } | ||
| {/* />*/ } | ||
| {/* {errors.title && <span className='text-red-500 text-xs'>{errors.title}</span>}*/ } | ||
| {/*</div>*/ } |
There was a problem hiding this comment.
Large block of commented-out code should be removed rather than left in the codebase. If this functionality might be needed later, consider using feature flags or version control history.
| {/*<div className='mb-4'>*/ } | |
| {/* <TextField*/ } | |
| {/* autoFocus*/ } | |
| {/* label='title'*/ } | |
| {/* value={title}*/ } | |
| {/* onChange={setTitle}*/ } | |
| {/* />*/ } | |
| {/* {errors.title && <span className='text-red-500 text-xs'>{errors.title}</span>}*/ } | |
| {/*</div>*/ } |
…#1398) * feat(orion-server): historical logs API & task_output refactor(#1379) Signed-off-by: MYUU <1405758738@qq.com> * feat(UI): add gpg-key setting (#1397) * feat(orion-server): add error handling for file operations, remove task-output-segment Signed-off-by: MYUU <1405758738@qq.com> --------- Signed-off-by: MYUU <1405758738@qq.com> Co-authored-by: Li WenLin <2839681263@qq.com>
No description provided.